package internal

import (
	"bootstrap"
	"encoding/json"
	"io/ioutil"
	"leaf"
)

type config struct {
	Bootstrap bootstrap.Config
	Leaf      leaf.RunArgs
	TcpAddr   string
}

var Config = new(config)

func (this *config) Init(configPath string) {
	data, err := ioutil.ReadFile(configPath)
	if err != nil {
		panic(err)
	}

	if err = json.Unmarshal(data, this); err != nil {
		panic(err)
	}
}
